package com.lavegue.common;

import java.io.Serializable;
import java.util.List;

/**
 * author: luoweibin
 * date:2011-12-21
 * description:
 *
 */
public abstract class BaseService<T, PK extends Serializable, DAO extends BaseDao> implements Service<T, PK,DAO> {

	private DAO dao;
	
	public void delete(T obj) {
		dao.delete(obj);
	}

	public void deleteById(PK id) {
		dao.deleteById(id);
	}

	public List<T> findAll() {
		return dao.findAll();
	}

	public T findById(PK id) {
		return (T) dao.findById(id);
	}

	public Page<T> findPage(int pageNo, int pageSize) {
		return dao.findPage(pageNo, pageSize);
	}


	public int getTotal() {
		return dao.getTotal();
	}

	public void save(T obj) {
		dao.save(obj);
	}

	public void update(T obj) {
		dao.update(obj);
	}

	public DAO getDao() {
		return dao;
	}

	public void setDao(DAO dao) {
		this.dao = dao;
	}
}

